<?php

/*
 * Action - Attack - Looter 4$
 *
 * Gain a Spoils from the Spoils pile. Each other player gains a Ruins.
 */

class Marauder extends Card implements iAction, iKingdom, iDarkAges, iAttack, iLooter {

    public function __construct() {
        parent::__construct("Marauder", 4);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "Gain a Spoils from the Spoils pile. Each other player gains a Ruins.");
    }

    public function play(Game $game, $isRealCard) {
        
        $game->attack($this);
        
        $s = $game->moveCardFromPileToPile(null, Spoils, DiscardPile);
        ScreenDisplay::addScreenMessage($game, true, "gain " . nicePrint($s), " gains " . ScreenDisplay::$LMSG);
        
        
        $names = $game->getOtherPlayersNames(true);
        foreach ($names as $name) {
            $ruin = new Ruin();
            $r = $game->moveCardFromPileToPile($ruin, BoardCards, DiscardPile, $name);
            ScreenDisplay::addScreenMessage($game, true, "gain " . nicePrint($r), " gains " . ScreenDisplay::$LMSG, $name);
        }
        $game->cardActionFinished();
        return true;
    }

    public function boardSetup(Game $game) {
        $game->addSpoils();
        $game->addRuins();
        return true;
    }

}

?>